package cn.dy.sbo.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import cn.common.lib.springside.entity.AutoIdEntity;

/**
 * 物料
 * @author mlv
 *
 */
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Materials extends AutoIdEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private String		name;	//物料描述
	private String		code;	//物料号
	private String		ename;//外文描述
	private float			onHand;	//库存中的实际数量
	private WareHouse		dfltWH;//默认仓库
	
	private float		maxLevel;//最大库存量
	
	private float		minLevel;//最小库存量
	
	private String		perUnit;//计量单位
	
	private	String		supplyName;//供货商
	
	private	String		purchaser;//采购
	
	private	String		type;//物料类别

	
	@Column(length=100)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(length=20)
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(length=100)
	public String getEname() {
		return ename;
	}

	public void setEname(String ename) {
		this.ename = ename;
	}

	public float getOnHand() {
		return onHand;
	}

	public void setOnHand(float onHand) {
		this.onHand = onHand;
	}

	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
    @NotFound(action = NotFoundAction.IGNORE)
	public WareHouse getDfltWH() {
		return dfltWH;
	}

	public void setDfltWH(WareHouse dfltWH) {
		this.dfltWH = dfltWH;
	}

	public float getMaxLevel() {
		return maxLevel;
	}

	public void setMaxLevel(float maxLevel) {
		this.maxLevel = maxLevel;
	}

	@Column(length=20)
	public String getPerUnit() {
		return perUnit;
	}

	public void setPerUnit(String perUnit) {
		this.perUnit = perUnit;
	}

	@Column(length=100)
	public String getSupplyName() {
		return supplyName;
	}

	public void setSupplyName(String supplyName) {
		this.supplyName = supplyName;
	}

	@Column(length=100)
	public String getPurchaser() {
		return purchaser;
	}

	public void setPurchaser(String purchaser) {
		this.purchaser = purchaser;
	}

	@Column(length=20)
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public float getMinLevel() {
		return minLevel;
	}

	public void setMinLevel(float minLevel) {
		this.minLevel = minLevel;
	}
	
}
